//Source file: D:\\aaa\\com\\ce\\pms\\charge\\model\\ChargeRecordDO.java

package com.ce.pms.charge.model;

import java.math.BigDecimal;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.ce.pms.common.model.SysInfo;
import com.ce.pms.exception.BusinessException;
import com.ce.pms.house.model.HouseDomain;
import com.ce.pms.renovation.model.AbstractChargeItemDO;
import com.ce.util.BlankUtil;
import com.sitechasia.webx.core.model.IDomainObject;

/**
 * 实体名称:费用记录 关联数据表:FEE_CHARGE_RECORD
 *
 * @author yandawei
 * @CreateDate:2008-12-17
 */
@Entity
@Table(name = "FEE_CHARGE_RECORD")
public class ChargeRecordDO implements IDomainObject {

	/**
	 * 主键
	 */
	@Id
	@GeneratedValue
	@Column(name = "CHARGE_RECORD_ID")
	private Long keyword;

	/**
	 * 是否已交易 1-yes, 0-no
	 */
	@Column(name = "HANDLE_YN", nullable = false, length = 1)
	private String handleYn;

	/**
	   001-押金收款：是在押金帐户中产生一条收款帐务记录
	   002 押金返还：是在押金帐户中产生一条正的帐务收款记录
	   003 押金抵冲：是在押金账户中产生一条抵冲专用交易码的负的帐务收款记录，同时在物业收费中增加一笔"已缴罚金"，同时增加一笔抵冲收到罚金记录
	   004 物业收费：是在物业收费账户中产生两笔账务记录，一个为应收记录，一个为实收记录
	   005 预交款收款
	 */
	@Column(name = "OPERATION_TYPE", nullable = false, length = 3)
	private String operationType;

	/**
	 * 入账方式,varchar(3) 001-直接入账，002-合并入账
	 */
	@Column(name = "ENTER_ACCOUNT_METHOD", nullable = false, length = 3)
	private String enterAccountMethod;

	/**
	 * 金额
	 */
	@Column(name = "SUM", precision = 12, scale = 2)
	private BigDecimal sum = new BigDecimal(0.00);

	/**
	 * 备注
	 */
	@Column(name = "REMARK", length = 100)
	private String remark;

	/**
	 * 房间
	 */
	@ManyToOne
	@JoinColumn(name = "HOUSE_ID",nullable = false)
	private HouseDomain house;

	/**
	 * 业务模块 001-装修管理
	 */
	@Column(name = "BIZ_MOUDLE", nullable = false, length = 3)
	private String bizModule;

	/**
	 * 业务类型
	 */
	@Column(name = "BIZ_TYPE", nullable = false, length = 3)
	private String bizType;

	/**
	 * 业务ID
	 */
	@Column(name = "BIZ_ID")
	private Long bizId;

	/**
	 * 交易码DO
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "BIZ_CODE_ID")
	private BusinessCodeDomain bizCode;

	/**
	 * 费用项目名称
	 */
	@Column(name = "ITEM_NAME", nullable = false, length = 50)
	private String itemName;

	/**
	 * 系统信息
	 */
	@Embedded
	@AttributeOverride(name = "sysDate", column = @Column(name = "SYS_DATE"))
	private SysInfo sysInfo;

	/**
	 * @roseuid 4941CF620290
	 */
	public ChargeRecordDO() {

	}

	/**
	 * @return com.ce.pms.renovation.model.AbstractChargeItemDO
	 * @roseuid 4941C54F002E
	 */
	public AbstractChargeItemDO getChargeItem() {
		return null;
	}

	public String getEnterAccountMethod() {
		return enterAccountMethod;
	}

	public void setEnterAccountMethod(String enterAccountMethod) {
		this.enterAccountMethod = enterAccountMethod;
	}

	public String getOperationType() {
		return operationType;
	}

	public void setOperationType(String operationType) {
		this.operationType = operationType;
	}

	public Long getBizId() {
		return bizId;
	}

	public void setBizId(Long bizId) {
		this.bizId = bizId;
	}

	public BusinessCodeDomain getBizCode() {
		return bizCode;
	}

	public void setBizCode(BusinessCodeDomain bizCode) {
		this.bizCode = bizCode;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public String getBizModule() {
		return bizModule;
	}

	public void setBizModule(String bizModule) {
		this.bizModule = bizModule;
	}

	public String getBizType() {
		return bizType;
	}

	public void setBizType(String bizType) {
		this.bizType = bizType;
	}

	public String getHandleYn() {
		return handleYn;
	}

	public void setHandleYn(String handleYn) {
		this.handleYn = handleYn;
	}

	public Long getKeyword() {
		return keyword;
	}

	public void setKeyword(Long keyword) {
		this.keyword = keyword;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public BigDecimal getSum() {
		return sum;
	}

	public void setSum(BigDecimal sum) {
		this.sum = sum;
	}

	public SysInfo getSysInfo() {
		return sysInfo;
	}

	public void setSysInfo(SysInfo sysInfo) {
		this.sysInfo = sysInfo;
	}

	public HouseDomain getHouse() {
		return house;
	}

	public void setHouse(HouseDomain house) {
		this.house = house;
	}

	/**
	 * 功能描述:判断必填项是否有值  <br>
	 *
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-12-26  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void checkRequiredField(){
		if (this.bizId == null
				|| BlankUtil.isBlank(this.bizModule)
				|| BlankUtil.isBlank(this.bizType)
				|| BlankUtil.isBlank(this.handleYn)
				|| BlankUtil.isBlank(this.operationType)
				|| BlankUtil.isBlank(this.enterAccountMethod)
				|| this.sysInfo==null
				|| this.sysInfo.getCreator() == null
				|| this.sysInfo.getSysDate() == null
				|| this.bizCode == null
				|| this.house == null
				|| BlankUtil.isBlank(this.itemName)) {
			throw new BusinessException("common:mustFill_null_exception",
					BusinessException.WARNING);
		}
	}

}
